package com.smasher.printdemo;

import android.os.Bundle;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.smasher.print.core.PrintFactory;
import com.smasher.print.core.PrintPlugin;

import java.util.List;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });

        initPlugins();
    }

    private void initPlugins() {
        // 获取可用设备列表供用户选择
        List<PrintPlugin> plugins = PrintFactory.getAvailablePlugins();
        for (PrintPlugin plugin : plugins) {
            System.out.println("设备: " + plugin.getPluginName() +
                    " (ID: " + plugin.getPluginId() + ")");
        }
    }
}